import { ReactElement, useEffect } from "react"
import { useSelector } from "react-redux"
import { post, get } from "@/utils/request"

export default function Test(): ReactElement<any, any> {
  const msg: string = useSelector((state: any): string => state.test.msg)
  useEffect(() => {
    // 第一层封装
    get("/movie/searchMovieList", { status: 1 }).then(res => {
      console.log(res, "1111")
    })
    post("/movie/login", { acc: "admin", pwd: 666 }).then(res => {
      console.log(res, "2222")
    })
    // 不封装直接使用
    // axios
    //   .get('/movie/searchMovieList', {
    //     params: {
    //       status: 1,
    //     },
    //   })
    //   .then(function (res) {
    //     console.log(res, '222222222')
    //   })
    //   .catch(function (error) {
    //     console.log(error)
    //   })
  }, [])
  return (
    <div>
      <h1>{msg}</h1>
      <button>按钮</button>
    </div>
  )
}
